import { http } from "@/utils/http";

export type ResultType = ReplaceTargetType<any[] | any>

/**
 * 分类查询列表-所有
 * @param params
 */
export const getCategoryTreeList = (params) => {
  return http.request<ResultType>({
    url: "/kgManagerApi/kg-manager/model/kg-category/tree/list",
    method: "get",
    params: {
      ...params
    }
  });
};

/**
 * 分类查询列表
 * @param params
 */
export const getCategoryPage = (params) => {
  return http.request<ResultType>({
    url: "/kgManagerApi/kg-manager/manager/conduct-kg/v1.0/category-page",
    method: "get",
    params: {
      ...params
    }
  });
};

/**
 * 分类详情
 * @param params
 */
export const getCategoryDetail = (vid) => {
  return http.request<ResultType>({
    url: `/kgManagerApi/kg-manager/manager/conduct-kg/v1.0/category-detail/${vid}`,
    method: "get",
  });
};

/**
 * 分类列表删除
 * @param params
 */
export const deleteCategory = (params) => {
  return http.request<ResultType>({
    url: `/kgManagerApi/kg-manager/manager/conduct-kg/v1.0/category-delete`,
    method: "post",
    params:{
      ...params
    }
  });
};

/**
 * 分类详情编辑
 * @param params
 */
export const updateCategory = (data) => {
  return http.request<ResultType>({
    url: `/kgManagerApi/kg-manager/manager/conduct-kg/v1.0/category-update`,
    method: "post",
    data
  });
};

